function getNews() {
  news = [], newsStr = ''
    , _arr = document.getElementsByTagName('strong')

  for (let i = 0, l = _arr.length - 1; i < l; i++) {
    if (_arr[i].style.fontSize == '16px') {
      let item = _arr[i].innerHTML.replace(/&nbsp;/ig, '').replace(/<\/?[^>]*>/g, '')
      // 去空
      if (item != '') {
        news.push(item)
      }
    }
  }
  // 数组去重
  news = [...new Set(news)]
}

function getNewsStr() {
  newsStr = news.reduce(function (total, cr, i) {
    if (total == 0) {
      return `1. ${cr}`
    } else {
      return `${total}\n${i + 1}. ${cr}`
    }
  }, 0)
  try {
    newsStr = newsStr.replace(/&nbsp;/ig, '')
    newsStr = newsStr.replace(/<\/?[^>]*>/g, '')
  } catch (error) {
  }
  getTimeStr()
}

function newsItem(v) {
  return v.innerHTML.replace(/&nbsp;/ig, '').replace(/<\/?[^>]*>/g, '')
}

function del(i) {
  news.splice(i - 1, 1)
  getNewsStr()
  console.log(timeStr)
}

// 连接两个
function connect(x, y) {
  news[x - 1] = news[x - 1] + news[y - 1]
  news.splice(y - 1, 1)
  getNewsStr()
  console.log(timeStr)
}

function getTimeStr() {
  timeStr = `接下来为您播放每日新闻：\n${newsStr}`
}

var timeStr;

getNews()

getNewsStr()

getTimeStr()

console.log(timeStr)


